<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="https://unpkg.com/vue@3/dist/vue.global.js"></script>
    <title>条件渲染</title>
</head>

<body>
    <div id="app">
        <h2>成绩等级判断</h2>
        <div>
            <label>请输入分数：</label>
            <input type="number" v-model.number="score" min="0" max="100">
        </div>
        <div>
            等级：
            <span v-if="score >= 90">A</span>
            <span v-else-if="score >= 80">B</span>
            <span v-else-if="score >= 70">C</span>
            <span v-else-if="score >= 60">D</span>
            <span v-else-if="score >= 0">E</span>
            <span v-else>请输入有效分数(0-100)</span>
        </div>
    </div>

    <script>
        const App = {
            data() {
                return {
                    score: ''
                }
            }
        };
        Vue.createApp(App).mount('#app');
    </script>
</body>

</html>